package usbcali.edu.persistencia.dto;

import usbcali.edu.persistencia.ClaseAlimento;

import usbcali.edu.presentation.backEndBeans.ClaseAlimentoView;

import java.io.Serializable;

import java.util.Date;

import javax.faces.event.ActionEvent;


/**
*
*
* @author Zathura Code Generator http://code.google.com/p/zathura
*
*/
public class ClaseAlimentoDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    private String codCAlimento;
    private String  descripcion;
    private boolean rowSelected = false;
    private ClaseAlimentoView claseAlimentoView;
    private ClaseAlimento claseAlimento;

    public ClaseAlimento getClaseAlimento() {
        return claseAlimento;
    }

    public String listener_update(ActionEvent e) {
    	 try {
             claseAlimentoView.action_modifyWitDTO(((codCAlimento == null) ||
                 codCAlimento.equals("")) ? null : new String(codCAlimento),
                 		((descripcion == null) || descripcion.equals("")) ? null
                                 : new String(descripcion));
             rowSelected = !rowSelected;
         } catch (Exception ex) {
             return "";
         }


        return "";
    }

    public void listener_cancel(ActionEvent e) {
        codCAlimento = claseAlimento.getCodCAlimento().toString();
        rowSelected = !rowSelected;
    }

    /**
    * <p>Bound to commandLink actionListener in the ui that renders/unrenders
        * the Customer details for editing.</p>
        */
    public void toggleSelected(ActionEvent e) {
        codCAlimento = claseAlimento.getCodCAlimento().toString();
        rowSelected = !rowSelected;
    }

    public void setClaseAlimento(ClaseAlimento claseAlimento) {
        this.claseAlimento = claseAlimento;
    }

    public ClaseAlimentoView getClaseAlimentoView() {
        return claseAlimentoView;
    }

    public void setClaseAlimentoView(ClaseAlimentoView claseAlimentoView) {
        this.claseAlimentoView = claseAlimentoView;
    }

    public String getCodCAlimento() {
        return codCAlimento;
    }

    public void setCodCAlimento(String codCAlimento) {
        this.codCAlimento = codCAlimento;
    }

    public boolean isRowSelected() {
        return rowSelected;
    }

    public void setRowSelected(boolean rowSelected) {
        this.rowSelected = rowSelected;
    }

	public String getDescripcion() {
		return descripcion;
	}

	public void setDescripcion(String descripcion) {
		this.descripcion = descripcion;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}
    
}
